import { PropsWithChildren } from 'react';
import { Redirect } from 'umi';
import useAuth from '@/hooks/useAuth';

export default function Auth(props: PropsWithChildren<unknown>) {
    const { isLogin } = useAuth();

    return isLogin ? props.children : <Redirect to="/login"></Redirect>;
}
